<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('【请填写功能名称】列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">


            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:group:add">
                    <i class="fa fa-plus"></i>新增
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:group:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:group:remove')}]];
        var privilegeFlag = [[${@permission.hasPermi('system:group:privilege')}]];
        var prefix = ctx + "system/group";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                privilegeurl: prefix + "/privilege/{id}",
                modalName: "会员组",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'groupid',
                    title: 'groupid',
                    visible: false
                },
                {
                    field: 'sort',
                    title: '序号'
                },
                {
                    field: 'groupname',
                    title: '用户组'
                },
                {
                    field: 'docnum',
                    title: '最低文档数'
                },

                {
                    field: 'divide',
                    title: '提现利率'
                },
                {
                    field: 'uploadcount',
                    title: '上传数量限制'
                },
                {
                    field: 'uploadsize',
                    title: '上传大小限制',
                    formatter: function(value, item, index) {
                        if (value == -1) {
                            return '<span class="label label-success">不限制</span>';
                        }
                        else{
                            return '<span class="label label-primary">'+value+'M</span>';
                        }

                    }
                },
                {
                    field: 'uploadexten',
                    title: '上传格式限制'
                },
                {
                    field: 'downcount',
                    title: '下载数量限制'
                },

                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.groupid + '\')"><i class="fa fa-edit"></i>设置</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.groupid + '\')"><i class="fa fa-remove"></i>删除</a>');
                        actions.push('<a class="btn btn-danger btn-xs ' + privilegeFlag + '" href="javascript:void(0)" onclick="$.operate.privilege(\'' + row.groupid + '\')"><i class="fa fa-remove"></i>权限</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>